package com.jinxin.platform.cdsmsmgr.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Utils {

    public static boolean isVerfifyCodeTemplate(String content){
        String pattern = ".*\\{[1-9]\\d*}.*";
        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(content);
        return m.matches();
    }

    public static String getUuid() {
        UUID uuid = UUID.randomUUID();
        return uuid.toString().replace("-", "");
    }
    /**
     * 获取位数为7位的随机数
     * @return
     * */
    public static String getRandom() {
        Random random = new Random();
        int nextInt = random.nextInt(9000000);
        nextInt=nextInt+1000000;
        return nextInt + "";
    }
    /**
     * 获得21位的主键值，主键值的格式是14位的当前时间加7位的随机数
     * @return
     **/
    public static String getMillPrimaryKey() {
        return DateUtil.getCurrentYMDHMS()+getRandom();
    }

    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("a","A");
        map.put("b","B");
        System.out.println(map.get("c") == null);
    }
}
